package com.gujia.util;

import com.gujia.model.HostHolder;
import com.gujia.model.User;
import org.springframework.beans.factory.annotation.Autowired;

import static sun.plugin2.main.client.ServiceDelegate.get;

/**
 * Created by GuJia on 2017/6/28.
 */
public class LoginUtil {

    private static ThreadLocal<User> users = new ThreadLocal<User>();

    public static User getUser() {

        return users.get();
    }

    public static void setUser(User user) {
        users.set(user);
    }

    public static int getUserId(){
        return users.get().getId();
    }

    public static void clear(){
        users.remove();
    }


}
